home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 011 / saver4.arc / SAVERES4.ASM next >
Encoding:
Assembly Source File  |  1986-08-09  |  5.0 KB  |  120 lines

  1. ;       Saveres4 -- *experimental* saverest with 4 screens -- adapted
  2. ;                   from SAVEREST by H.M. Van Tassell
  3.  
  4. ;    To generate .BIN file for for dBaseIII LOAD/CALL
  5. ;       1. MASM saveres4;
  6. ;       2. LINK saveres4;
  7. ;       3. EXE2BIN saveres4
  8. ;    Use the file saveres4.BIN with your dBaseIII+ program
  9. ;       Syntax: CALL SaveRest WITH "Sx" or "Rx"  where "x" is between
  10. ;               0 and 3 ONLY!! (other values will do nothing).
  11.  
  12. ;    NOTE: I can't see what good this thing is until it can save and restore
  13. ;          from files, that's next.  Also on the agenda:compression of data,
  14. ;          load from UI/SAYWHAT!? files, etc.
  15. ;
  16. ;    R. Russell Freeland
  17. ;    Synergy Corp.
  18. ;    (voice) 305/792-1866
  19. ;    CIS:76146,371
  20. ;    8/8/1986
  21.  
  22. code_seg segment byte public 'code'
  23.       assume      cs:code_seg   ;,ds:code_seg,es:code_seg,ss:code_seg
  24.  
  25. saverest proc far
  26. org 0
  27. main: jmp begin
  28.  
  29. save_which      db      ?
  30. screen_mode     db      0FFh    ; screen mode, 7 = mono
  31. screen_page     db      0       ; current page here
  32. cursor_pos      dw      0       ; store cursor position here
  33. screen_buffer   dw  2000*4 DUP(?); local screen buffer storage area
  34.  
  35. begin:
  36.         push ds
  37.         push es
  38.         cld
  39.         mov al,Byte Ptr[bx+1]   ;save the second char in "save_which"
  40.         mov Byte Ptr CS:save_which,al ;thru AL register
  41.         cmp al,'0'              ;is it
  42.         jb  nogood              ;within
  43.         cmp al,'3'              ;bounds?
  44.         ja  nogood              ;if not, we're done
  45.         mov al,Byte Ptr[bx]     ; get passed dBASEIII first parameter char
  46.         and al,05Fh             ; make sure it is upper case
  47.         cmp al,'S'              ; if Save screen
  48.         je save_screen          ;    jump to save screen routine
  49.         cmp al,'R'              ; if Restore screen
  50.         je restore_screen       ;    jump to restore screen routine
  51. nogood:
  52.         jmp finish              ; else return back to dBASEIII
  53. ;
  54. save_screen:
  55.         xor al,al               ; first get screen mode and page
  56.         mov ah,15               ; function 15 return mode in AL
  57.         int 10h                 ; and page in BH
  58.         mov Byte Ptr CS:screen_mode,al  ; store em
  59.         mov Byte Ptr CS:screen_page,bh  ; for future use
  60.         xor al,al               ; now get the current cursor position
  61.         mov ah,3                ; function 3 reads cursor position
  62.         int 10h                 ; returns DH,DL=cursor row,col
  63.         mov Word Ptr CS:cursor_pos,dx   ; store it
  64.         mov ax,0B000h           ; preload mono buffer segment
  65.         cmp Byte Ptr CS:screen_mode,07h ; is 7 if mono mode
  66.         je save_mono
  67.         mov ax,0B800h           ; it is not mono mode
  68. save_mono:
  69.         mov ds,ax               ; DS:SI must point start of screen memory
  70.         mov si,0
  71.         push cs
  72.         pop es                  ; ES:DI must point to screen buffer
  73.         mov di,offset CS:screen_buffer
  74.         xor ax,ax               ; clear AX
  75.         mov al,Byte Ptr CS:save_which   ; get second dBASE parameter character
  76.         xor ax,0030h            ; convert to a number
  77.         mov  cx,4000d
  78.         mul cx                  ; multiply ax*4000
  79.         add di,ax               ; and offset that far into the buffer
  80.         mov cx,2000             ; number of words to save
  81.         rep movsw               ; move the screen memory to the buffer
  82.         jmp finish              ; and return back to dBASEIII
  83. ;
  84. restore_screen:
  85.         ;
  86.         cmp Byte Ptr CS:screen_mode,0FFh; if the screen mode byte hasn't
  87.         jne saved               ; changed, we havn't first saved
  88.         jmp finish              ; a screen, so return to dBASEIII
  89. saved:  mov bh,Byte Ptr CS:screen_page  ; BH = current display page
  90.         mov dx,Word Ptr CS:cursor_pos   ; DH,DL = row,col of current position
  91.         xor al,al               ; first restore prior cursor position
  92.         mov ah,2                ; function 2 sets cursor position with
  93.         int 10h                 ; DH,DL=cursor row,col and BH = page
  94.         mov ax,0B000h           ; preload mono buffer segment
  95.         cmp Byte Ptr CS:screen_mode,07h ; is 7 if mono mode
  96.         je restore_mono
  97.         mov ax,0B800h           ; it is not mono mode
  98. restore_mono:
  99.         mov ES,ax               ; ES:DI must point start of screen memory
  100.         mov di,0
  101.         xor ax,ax
  102.         mov al,Byte Ptr CS:save_which  ; get dBASE second parameter character
  103.         xor ax,0030h            ; convert to a number
  104.         mov  cx,4000d           ; multiply ax*4000
  105.         mul  cx
  106.         mov si,offset CS:screen_buffer
  107.         add  si,ax              ; and offset that far into the buffer
  108.         push cs
  109.         pop ds                  ; DS:SI must point to screen buffer
  110.         mov cx,2000             ; number of words to restore
  111.         rep movsw               ; move the buffer to the screen memory
  112. finish:
  113.         pop es
  114.         pop ds
  115.         ret                     ; return back to dBASEIII+
  116.  
  117. saverest endp
  118. code_seg ends
  119.       END main
  120.